/*
 * @Author: [wcy]
 * @Date: 2021-12-06 13:26:11
 * @LastEditors: [wcy]
 * @LastEditTime: 2021-12-15 17:42:28
 * @Description: 
 */
import {
  request
} from "../../request/index.js"
Page({
  data: {
    // 轮播图数组
    swiperList: [],
    // 导航栏数据
    careList:[],
    // 楼层数据
    floorList:[]
  },
  //options(Object)
  onLoad: function (options) {
    this.getSwiperList(),
    this.getCateList(),
    this. getFloorList()
  },
  // 获取轮播图数据
  getSwiperList() {
    request({
        url: "/home/swiperdata"
      })
      .then(res => {
        this.setData({
          swiperList: res
        })
      })
  },
  // 获取导航栏数据
  getCateList() {
    request({
        url: "/home/catitems"
      })
      .then(res => {
        this.setData({
          careList: res
        })
      })
  },
  // 获取楼层数据
  getFloorList() {
    request({
        url: "/home/floordata"
      })
      .then(res => {
        for(let k=0;k<res.length;k++){
          res[k].product_list.forEach((v,i)=>{
            res[k].product_list[i].navigator_url=v.navigator_url.replace('?','/index?');
          })
        }
        this.setData({
          floorList: res
        })
        
      })
    
  },
});